-
Notifications
You must be signed in to change notification settings - Fork 14
tests: unittest: Added unittests for bm_nus #345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
You can find the documentation preview for this PR here. |
78523d0
to
643ac78
Compare
Added unit tests for subsys bm_nus Signed-off-by: Martin Engesvold <[email protected]>
643ac78
to
860ab82
Compare
TEST_ASSERT_EQUAL(BLE_GATTS_SRVC_TYPE_PRIMARY, type); | ||
TEST_ASSERT_EQUAL(expected_uuid.type, p_uuid->type); | ||
TEST_ASSERT_EQUAL(expected_uuid.uuid, p_uuid->uuid); | ||
TEST_ASSERT_EQUAL(expected_conn_handle, *p_handle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should set the conn_handle afterwards. Then we can check that this is propagated later.
struct ble_nus_client_context *last_link_ctx; | ||
|
||
static uint32_t stub_sd_ble_gatts_service_add(uint8_t type, ble_uuid_t const *p_uuid, | ||
uint16_t *p_handle, int calls) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid hungarian notation (where we can, SoftDevice will still have it)
uint16_t *p_handle, int calls) | |
uint16_t *handle, int calls) |
default: | ||
return -1; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: extra newline
evt_handler_called = true; | ||
} | ||
|
||
static void init_nus(struct ble_nus_config *nus_cfg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static void init_nus(struct ble_nus_config *nus_cfg) | |
static void nus_init(struct ble_nus_config *nus_cfg) |
TEST_ASSERT_EQUAL_PTR(nus_cfg->evt_handler, ble_nus.evt_handler); | ||
} | ||
|
||
static void setup_with_notif_enabled(uint16_t conn_handle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the ble_nus_on_ble_evt
here should be kept as a as a separate call after init in the test. It makes it a lot easier to follow each test and see the difference.
Added unit tests for subsys bm_nus